package com.first;

import java.util.ArrayList;

/**
 * Author Name: Justice
 * Project Name: Stage11
 * File Name: ArrayCommon
 * Package Name: com.first
 * Date: 2020-03-25 22:16
 * Copyright (c) 2020,All Rights Reserved.
 */


public class ArrayCommon {
    public static void main(String[] args) {
        int[] arr1 = {1, 2, 3, 4, 5};
        int[] arr2 = {1, 2, 5, 9, 11};
        getCommon(arr1, arr2);
    }

    private static void getCommon(int[] arr1, int[] arr2) {
        ArrayList<Integer> list2 = new ArrayList<Integer>();
        ArrayList<Integer> list1 = new ArrayList<Integer>();
        for (Integer i : arr1) {
            list1.add(i);
        }
        for (Integer j : arr2) {
            list2.add(j);
        }
        list1.removeAll(list2);
        System.out.println(arr1.length - list1.size());
    }
}
